<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/icon.css">
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/locale/easyui-lang-zh_CN.js"></script>
		<script>

		$(function(){
					
			/*表格初始化*/
			$("#grid").datagrid({
				singleSelect:true,
				fit:true,
				//fitColumns:true,
				collapsible:true, 
				striped:true,
				rownumbers:true, 
			    columns:[[    
			    	{field:'CK',checkbox:true},
			        {field:'person_id',title:'企业名称人名',width:400,align:'left'},
			        {field:'filing',title:'filing',width:50,align:'right'},
			        {field:'qualifi_type',title:'qualifi_type',width:200,align:'right'},    
			        {field:'qualifi_name',title:'qualifi_name',width:200,align:'right'},    
			        {field:'qualifi_major',title:'qualifi_major',width:200,align:'center'},  
			        {field:'level_name',title:'证书等级',width:100,align:'right'},
			        {field:'cert_num',title:'证书号',width:200,align:'right'},
			        {field:'registered_num',title:'注册证书号',width:200,align:'right'},
			        {field:'issued_by',title:'发证机关',width:200,align:'right'},
			        {field:'issued_date',title:'发证日期',width:100,align:'right'},
			        {field:'expiry_start',title:'证书有效期起',width:200,align:'right'},
			        {field:'expiry_end',title:'证书有效期止',width:200,align:'right'},
			        {field:'begin_registered_date',title:'开始注册时间',width:100,align:'right'},
			        {field:'is_del',title:'是否已删除',width:100,align:'right'}
			    ]],
			    pagination:true,
			    pageSize:20,
			    pageList:[10,20,30,50,100,200,500]
			});
			
			
			
			function query(){
				$("#grid").datagrid({
					url:'/standardLib/personCert/getPersonCertList',
					method:"POST",
					queryParams: parent.getFormJson($("#search_form"))
				});
			}
			
			//查询按钮
			$("#search_btn").click(query);
			//query();
			
			
			$("#show_column_from_btn").click(function(){
				var rows = $('#grid').datagrid('getSelections');
				if(rows.length<1){
					$.messager.alert('提示','请勾选一条');
					return false;
				}
				var company_name = rows[0].company_name;
				$.post("/dataTransferConfig/dataMerge/getCompanyDataSource",{table_code:'company_main',key_column_value:company_name},function(response){
					
					$("#show_grid").datagrid({
						singleSelect:true,
						fit:true,
						fitColumns:true,
						collapsible:true, 
						striped:true,
						columns:[[    
					        {field:'field_code',title:'字段编码',width:100,align:'left'},
					        {field:'field_name',title:'字段名称',width:100,align:'left'}, 
					        {field:'data_source_name',title:'数据来源名称',width:200,align:'left'}   
					    ]],
						data:response
					});
					$("#show_dialog").dialog({ 
						title: '查看数据来源',    
						width: 900,    
						height: 600,    
						closed: false,    
						cache: false,
				   		modal: true
					});
					
					//$.messager.alert('提示',JSON.stringify(response));
				})
			});

			$('#search_cert_dict_id').combobox({
			    url:'/common/dict/getComboboxPersonCertDict',
			    valueField:'code',
			    width:400,
			    textField:'name',
			    filter: function(q, row){
					var opts = $(this).combobox('options');
					return row[opts.textField].indexOf(q) >= 0;
				}
			});

			$("#update_all_btn").click(function(){
				$.post("/dataMarge/personCert",{},function(response){
						$.messager.alert('提示',response);
						$("#grid").datagrid('reload');
				})
			});
			
		});
			
		</script>
	</head>
	<body class="easyui-layout">
		
		<!-- 查询条件表单 -->
		<div region="north" border="false"   style="width:100%;height:80px;margin-top: 20px;" >
			<form id ="search_form" method="post" class="easyui-form">
				<table width="100%">
					<tr>

						<td align="right" width="5%">企业名称姓名:</td>
						<td width="15%"  align="left">
							<input class="easyui-textbox"  name="person_id" style="width:500px"  />
                        </td>
                        <td align="right" width="10%">证书类别:</td>
						<td width="30%"  align="left">
							<input class="easyui-textbox" id="search_cert_dict_id"  name="apt_dict_id" style="width:400px" />
						</td>
						<td width="20%" ></td>
					</tr>
				</table>

			</form>
			
			<a href="#" id="search_btn" class="easyui-linkbutton"	 data-options="iconCls:'icon-search'"  >查询</a>
			<a href="#" id='show_column_from_btn' class="easyui-linkbutton" data-options="iconCls:'icon-edit'">查看数据来源</a>
		</div>
		
		
		
		<!-- 主表格 -->
		<div region="center" border="false">
			
			<table id="grid" ></table>
		</div>
		
		
		<!-- 一些隐藏的对话框 -->
		<div style="display:none" id="show_dialog">
			<table id="show_grid" ></table>
		</div>

	</body>
</html>
